#ifndef GAME_STATE_H_INCLUDED
#define GAME_STATE_H_INCLUDED

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<time.h>

using std::pair;
using std::make_pair;
using std::vector;

class GameState {
 private:
    int alphabet_sz;
    int length;
    vector<int> sequence;
    int bulls;
    int cows;
    bool win;
 public:
    GameState(int sz, int len) :
         alphabet_sz(sz), length(len), sequence(seq), bulls(0), cows(0), win(0) {
    }

    pair<int, int> answerForRequest(vector<int> &request) {
        if (request.size() != length) {
            throw "Lengths differ";
        }
        for (auto elem : request) {
            if (elem > alphabet_sz) {
                throw "Non-identified symbol";
            }
        }
        for (int i = 0; i < request.size(); ++i) {
            if (sequence[i] == request[i]) {
                ++bulls;
            } else if (std::find(sequence.begin(), sequence.end(), request[i]) != sequence.end()) {
                ++cows;
            }
        }
        if (bulls == len) {
            win = true;
        }
        pair<int, int> answer_for_request = make_pair(bulls, cows);
        bulls = 0;
        cows = 0;
        return answer_for_request;
    }

    bool state() {
        return win;
    }
};

#endif // GAME_STATE_H_INCLUDED
